<?php
include "../lib/DAL/KhoaHoc.php";
class KhoaHocBLL{
    function __construct(){
        
    }
    
    function __destruct(){
        
    }
    
    function setKhoaHocBLL($row){
        $khoahoc= new KhoaHoc();
        $khoahoc->setKhoahoc($row['id_khoahoc'],$row['id_dv_ctdt'],$row['ma_cb'],$row['mota_khoahoc'],$row['nam_khoahoc']);
        return $khoahoc;
         
    }

    public function getListKhoaHoc(){
      $result = mysql_query("select * from tbl_khoahoc");
      $arr= array();
      
      while($row = mysql_fetch_array($result)){
        $arr[] =  $this->setKhoaHocBLL($row);
      }
      return $arr;
    }
    
    public function getListNamKhoaHoc(){
      $result = mysql_query("select distinct nam_khoahoc from tbl_khoahoc");
      $arr= array();
      
      while($row1 = mysql_fetch_array($result)){
        $row['id_khoahoc']="";
        $row['id_dv_ctdt']="";
        $row['ma_cb']="";
        $row['mota_khoahoc']="";
        $row['nam_khoahoc']=$row1['nam_khoahoc'];
        $arr[] =  $this->setKhoaHocBLL($row);
      }
      return $arr;
    }
    
    
    
}

?>